#ifdef a
#include<iostream>

//有效的括号
bool isValid(char* s) {
	if(strlen(s) % 2)
		return false;
	char arr[100] = { 0 };
	int sz = 0;
	for (int i = 0; s[i] != '\0'; i++) {
		if (s[i] == '(' || s[i] == '{' || s[i] == '[')
			arr[sz++] = s[i];
		else {
			if ( (sz > 0) && 
				(s[i] == '}' && arr[sz - 1] == '{') ||
				(s[i] == ')' && arr[sz - 1] == '(') ||
				(s[i] == ']' && arr[sz - 1] == '['))
				sz--;
			else
				return false;
		}
	}
	return true;
}
int main() {
	char s[] = "[{}()]";
	printf("%d\n", strlen(s));
	if (isValid(s)) {
		printf("括号匹配!\n");
	}
	else
		printf("括号不匹配\n");
	return 0;
}
#endif